<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> 
    <!--
    Author Lu Xiaodi
    -->
    <h:head> 
        <title>IOTR</title> 

        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            }
        </style> 

    </h:head> 
    <h:body>     
        <ez:RepHeaderMenu/>
        <h1>Integrated Online Ticketing and Reservation (IOTR)- Representative Portal</h1> 

        <p:layout style="table-layout:auto; height:600px ">

            <p:layoutUnit position="left" header="Navigation" width="300">
                <ez:RepIOTRLeftMenu/>
            </p:layoutUnit>

            <p:layoutUnit position="center" header="Settings" scrollable="true">

                <h:outputText  value="Status Message: "/>
                <h:outputText style="font-weight: bold; color:#D20005" value="#{groupBuyingManagedBean.statusMsg}"/>
                <br/>

                <h:outputText style="font-weight: bold" value="Add new group buying item: "/>

                <h:form>
                    <h:panelGrid columns="3" style="text-align: left">

                        <h:outputLabel for="name" value="Item Name: "/>
                        <p:inputText id="name" value="#{groupBuyingManagedBean.name}" required="true"
                                     requiredMessage="dish name required!"/>
                        <p:message for="name"/>

                        <h:outputLabel for="originalPrice" value="Original Price: "/>
                        <p:inputText id="originalPrice" value="#{groupBuyingManagedBean.originalPrice}" required="true"
                                     requiredMessage="price value needed!">
                            <f:validateDoubleRange minimum="0"/>
                        </p:inputText>
                        <p:message for="originalPrice"/>


                        <h:outputLabel for="offerPrice" value="Offering Price: "/>
                        <p:inputText id="offerPrice" value="#{groupBuyingManagedBean.offeredPrice}" required="true"
                                     requiredMessage="price value needed!">
                            <f:validateDoubleRange minimum="0"/>
                        </p:inputText>
                        <p:message for="offerPrice"/>

                        <h:outputLabel for="effectiveStart" value="Effective Start Date: "/>
                        <p:calendar id="effectiveStart" value="#{groupBuyingManagedBean.effectiveStart}"
                                    pattern="dd MMM, yyyy (EEE)"/>
                        <p:message for="effectiveStart"/>


                        <h:outputLabel for="effectiveEnd" value="Effective End Date: "/>
                        <p:calendar id="effectiveEnd" value="#{groupBuyingManagedBean.effectiveEnd}"
                                    pattern="dd MMM, yyyy (EEE)"/>
                        <p:message for="effectiveEnd"/>

                        <h:outputLabel for="redemptionStart" value="Redemption Start Date: "/>
                        <p:calendar id="redemptionStart" value="#{groupBuyingManagedBean.redemptionStart}"
                                    pattern="dd MMM, yyyy (EEE)"/>
                        <p:message for="redemptionStart"/>

                        <h:outputLabel for="redemptionEnd" value="Redemption End Date: "/>
                        <p:calendar id="redemptionEnd" value="#{groupBuyingManagedBean.redemptionEnd}"
                                    pattern="dd MMM, yyyy (EEE)"/>
                        <p:message for="redemptionEnd"/>

                        <h:outputLabel for="minQuota" value="Minimum Quota: "/>
                        <p:inputText id="minQuota" value="#{groupBuyingManagedBean.minQuota}" required="true"
                                     requiredMessage="price value needed!">
                        </p:inputText>
                        <p:message for="minQuota"/>

                        <h:outputLabel for="maxQuota" value="Maximum Quota: "/>
                        <p:inputText id="maxQuota" value="#{groupBuyingManagedBean.maxQuota}" required="true"
                                     requiredMessage="price value needed!">
                        </p:inputText>
                        <p:message for="maxQuota"/>
                        
                        <h:outputLabel for="personalQuota" value="Maximum pieces can be bought by person: "/>
                        <p:inputText id="personalQuota" value="#{groupBuyingManagedBean.personalQuota}" required="true"
                                     requiredMessage="personal quota value needed!">
                        </p:inputText>
                        <p:message for="personalQuota"/>

                        <h:outputLabel for="requireBooking" value="Require booking: "/>
                        <h:selectOneRadio id="requireBooking" value="#{groupBuyingManagedBean.requireBookingStr}"
                                          required="true" requiredMessage="field cannot be empty">
                            <f:selectItem id="auto" itemLabel="yes" itemValue="true"/>
                            <f:selectItem id="manual" itemLabel="no" itemValue="false"/>
                        </h:selectOneRadio>
                        <p:message for="requireBooking"/>


                        <h:outputLabel for="validateRequirements" value="Validate Requirements: "/>
                        <p:inputTextarea id="validateRequirements" 
                                         value="#{groupBuyingManagedBean.validateRequirements}" 
                                         required="true" requiredMessage="price value needed!"
                                         style="width:500px; height:300px"/>
                        <p:message for="validateRequirements"/>


                        <h:outputLabel for="description" value="Description: "/> 
                        <p:inputTextarea id="description" 
                                         value="#{groupBuyingManagedBean.description}" 
                                         required="true" requiredMessage="price value needed!"
                                         style="width:500px; height:300px"/>
                        <p:message for="description"/>

                    </h:panelGrid>

                    <p:commandButton id="newProposal" value="Submit new item proposal" ajax="false"
                                     actionListener="#{groupBuyingManagedBean.addNewProposal}"
                                     update="display" />
                </h:form>

            </p:layoutUnit>
        </p:layout>



    </h:body> 
</html>